package com.kun.common.file.minio;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;

/**
 * @author kun.li
 */

public class MinioAutoConfiguration {
    @Bean
    @ConditionalOnMissingBean(MinioProperties.class)
    @ConditionalOnProperty(name = "file.minio.enable", havingValue = "true", matchIfMissing = true)
    public MinioProperties minIoProperties() {
        return new MinioProperties();
    }

    @Bean
    @ConditionalOnMissingBean(MinioTemplate.class)
    @ConditionalOnProperty(name = "file.minio.enable", havingValue = "true", matchIfMissing = true)
    public MinioTemplate minioTemplate(MinioProperties minIoProperties) {
        return new MinioTemplate(minIoProperties);
    }

}
